<template>
  <div class="title-container" :class="{ pad_l: line }" :style="{color: fontColor}">
    <div v-if="line" class="line" :style="{background: lineColor || fontColor}" />
    <h1>{{ title }}</h1>
    <div v-if="more" class="more" fz12 @click="goMore"><span>更多</span><i class="iconfont icon-r_arrow" /> </div>
  </div>
</template>

<script>
export default {
  name: 'GTitle',
  props: {
    title: {
      // 标题
      type: String,
      default: ''
    },
    line: {
      type: Boolean,
      default: false
    },
    fontColor: {
      type: String,
      default: ''
    },
    lineColor: {
      type: String,
      default: ''
    },
    border: {
      type: Boolean,
      default: false
    },
    more: {
      type: String,
      default: ''
    }
  },
  methods: {
    goMore() {
      this.$router.push(this.more)
    }
  }
}
</script>

<style lang="scss" scoped>
.title-container {
  text-align: left;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-right: 15px;
  position: relative;
  display: flex;
  line-height: normal;
  justify-content: space-between;
  &.pad_l {
    padding-left: 15px;
    .line {
      display: block;
      height: 16px;
      width: 2px;
      background: $color-primary;
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
    }
  }

  h1 {
    padding-left: 14px;
    font-size: 14px;
    font-weight: bold;
    margin: 0;
    flex: 1
  }
  .more {
    text-align: right;
    color: #ccc;
    display: flex;
    .iconfont {
      display: inline-block;
      transform: scale(0.5);
    }
  }
}
</style>
